package campus.service.impl;

import campus.mapper.AccountMapper;
import campus.mapper.AccountSettingsMapper;
import campus.model.Account;
import campus.model.AccountExample;
import campus.model.AccountSettings;
import campus.service.AccountService;
import campus.service.AccountSettingsService;
import campus.util.PageResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
     * @Author M
     * @name 银行存款实现22
     * @Date 21:46 2020/5/10
 **/
@Service
public class AccountSettingsServiceImpl implements AccountSettingsService {

    @Autowired
    private AccountSettingsMapper accountSettingsMapper;
    @Override
    public List<AccountSettings> selectByExample(AccountExample example) {
        return accountSettingsMapper.selectByExample(null);
    }

    @Override
    public int insert(AccountSettings accountSettings) {
        return accountSettingsMapper.insert(accountSettings);
    }

    @Override
    public int deleteByPrimaryKey(Integer zhId) {
        return accountSettingsMapper.deleteByPrimaryKey(zhId);
    }

    @Override
    public int updateByPrimaryKeySelective(AccountSettings record) {
        return accountSettingsMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public PageResult findByAllPageSize(AccountSettings accountSettings, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        accountSettings.setZhStatus("1");
        Page<AccountSettings> findlog = (Page<AccountSettings>) accountSettingsMapper.findByAllPageSize(accountSettings);
        return new PageResult(findlog.getTotal(),findlog.getResult());
    }
    @Override
    public PageResult findByAllPageSize2(AccountSettings accountSettings, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        accountSettings.setZhStatus("2");
        Page<AccountSettings> findlog = (Page<AccountSettings>) accountSettingsMapper.findByAllPageSize(accountSettings);
        return new PageResult(findlog.getTotal(),findlog.getResult());
    }

    @Override
    public AccountSettings findByPrimaryKey(Integer zhId) {
        return accountSettingsMapper.findByPrimaryKey(zhId);
    }
}
